package main.java.game.terrain;


import java.util.LinkedList;
import java.util.List;

import main.java.game.Card;
import main.java.game.Game;
import main.java.game.combatant.Hero;
import main.java.game.combatant.Monster;

public class Swamp extends Terrain{
	
	public Swamp(String name) {
		super(name);
	}
	
	private List<Monster> lm=new LinkedList<Monster>();
	
	public void setTerrain(Game game){
		super.setTerrain(game);
		List<Hero> listH =game.getPlayer().getHeroes();
		for(Hero hero: listH){
			hero.setInit(hero.getInit()-3);
			hero.setBlockedRegeneration(true);
		}	
		
		System.out.println("All your heroes have 3 less init points!\n");
		List<Monster> lm=new LinkedList<Monster>();
		for(Card c: game.getAdventurePile()){
			if(c instanceof Monster)
				lm.add((Monster)c);
		}
		
		for(Monster monster: lm){
			if(monster.getName().equals("Swamp Beast")){
				monster.setInit(monster.getInit()+4);
				System.out.println("And the Swamp Beast gots +4 init!");
			}
		}
	}
	public void stopUsingTerrain(Game game){
		game.getDiscardPile().add(this);
		game.setTerrainPile(null);
		List<Hero> listH =game.getPlayer().getHeroes();
		for(Hero hero: listH){
			hero.setInit(hero.getInit()+3);
			hero.setBlockedRegeneration(false);
			
		}	
		
		for(Monster monster: lm){
			if(monster.getName().equals("Swamp Beast")){
				monster.setInit(monster.getInit()-4);
			}
		}
		
		
	}

}
